﻿<%@ Page Language="C#" MasterPageFile="~/dangviet.Master" AutoEventWireup="true"
    CodeBehind="GioHang.aspx.cs" Inherits="SES.CMS.GioHang" Title="Giỏ hàng" %>

<%@ Register Src="Module/ucTag.ascx" TagName="ucTag" TagPrefix="uc2" %>
<%@ Register Src="Module/ucBreadcrumb.ascx" TagName="ucBreadcrumb" TagPrefix="uc5" %>
<%@ Register Src="Module/ucSupportOnline.ascx" TagName="ucSupportOnline" TagPrefix="uc6" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <uc5:ucBreadcrumb runat="server" ID="brc1" />
    <div id="dProductDetail">
        <asp:UpdatePanel runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Label ID="lbl" runat="server"></asp:Label>
                <asp:GridView runat="server" ID="GridGioHang" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
                    AllowPaging="True" OnPageIndexChanging="GridGioHang_PageIndexChanging" OnRowCommand="GridGioHang_RowCommand"
                    CellPadding="4" Width="740px" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
                    OnRowDataBound="GridGioHang_RowDataBound" DataKeyNames="STT" OnDataBinding="GridGioHang_DataBinding"
                    OnDataBound="GridGioHang_DataBound" CssClass="mGrid" PagerStyle-CssClass="pgr"
                    AlternatingRowStyle-CssClass="alt" RowStyle-CssClass="rgr" HeaderStyle-CssClass="hgr">
                    <RowStyle />
                    <Columns>
                        <asp:TemplateField HeaderText="STT" ItemStyle-Width="13px">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbSTT" Text="<%# Container.DataItemIndex + 1 %>">
                                </asp:Label>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <FooterTemplate>
                                Tổng tiền:
                            </FooterTemplate>
                            <FooterStyle BorderColor="White" Font-Bold="true" ForeColor="Red" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên sản phẩm" ItemStyle-Width="180px">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="txtTen" Text='<%#DataBinder.Eval(Container.DataItem,"TenSanPham") %>'>
                                </asp:Label>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ảnh SP" ItemStyle-Width="65px">
                            <ItemTemplate>
                                <a class="fackybox" href="/Media/<%#Eval("HinhAnh")%>" />
                                <img src="/Media/<%#Eval("HinhAnh")%>" height="40px" width="64px" /></a>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số Lượng" ItemStyle-Width="50px">
                            <ItemTemplate>
                                <asp:TextBox runat="server" OnTextChanged="Calc" AutoPostBack="true" ID="txtSL" Width="20px"
                                    Style="float: right;" Text='<%#DataBinder.Eval(Container.DataItem,"SoLuong") %>'>
                                </asp:TextBox>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <FooterStyle BorderColor="White" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Đơn Giá" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="90px">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbDG" Text='<%#DataBinder.Eval(Container.DataItem,"DonGia","{0:0,0 VNĐ}") %>'>
                                </asp:Label>
                            </ItemTemplate>
                            <FooterStyle BorderColor="White" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Giảm Giá (%)" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70px"
                            Visible="false">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbDGG" Text='<%#Eval("GiamGia") +"%" %>'>
                                </asp:Label>
                            </ItemTemplate>
                            <FooterStyle BorderColor="White" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Thành Tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="110px">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lbThanhTien" Font-Bold="true" Text='<%#DataBinder.Eval(Container.DataItem,"ThanhTien","{0:0,0 VNĐ}") %>'>
                                </asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:Label ID="lbTong" runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
                            </FooterTemplate>
                            <FooterStyle HorizontalAlign="Center" BorderColor="White" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Thao tác">
                            <ItemTemplate>
                                <asp:ImageButton runat="server" ID="imgUpdate" CommandName="capnhat" ToolTip="Cập nhật số lượng"
                                    CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/update_quantity.png" />
                                <asp:ImageButton runat="server" ID="img_xoa" CommandName="xoa" OnClientClick="return confirm('Bạn có muốn loại bỏ sản phẩm này ra khỏi giỏ hàng?')"
                                    CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/remove.png" />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <FooterStyle BorderColor="White" />
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle />
                    <PagerStyle />
                    <SelectedRowStyle />
                    <HeaderStyle />
                </asp:GridView>
                <br />
                <div style="width: 400px; margin-left: auto; margin-right: 10px; text-align: right;">
                    <asp:Label ID="lblSum" runat="server"></asp:Label><br />
                    <asp:Label ID="lbThanhTien" runat="server"></asp:Label>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div align="center" style="margin: 10px 0;" class="ltr dGioHang">
            <a href="/Default.aspx" class="continue_link">Tiếp tục mua hàng</a>
            <asp:HyperLink runat="server" ID="lbThanhtoan" CssClass="checkout_link" Text="Gửi đơn hàng"
                NavigateUrl="/ThanhToan.aspx"></asp:HyperLink>
        </div>
         </div>
        <div class="list-product-wrap">
            <h2 class="h2-info">
                Sản phẩm nổi bật</h2>
            <div class="product-wrap">
                <ul class="list-product">
                    <asp:Repeater runat="server" ID="rpt">
                        <ItemTemplate>
                            <li>
                                <div class="product-image-wrap">
                                    <a href='/SanPhamChiTiet/<%#Eval("SanPhamID")%>/<%#FriendlyUrl(Eval("TenSanPham").ToString())%>'>
                                        <img src='/Media/<%#Eval("HinhAnh")%>' title='<%#Eval("TenSanPham")%>' alt='<%#Eval("TenSanPham") %>' />
                                    </a>
                                </div>
                                <a href='/SanPhamChiTiet/<%#Eval("SanPhamID")%>/<%#FriendlyUrl(Eval("TenSanPham").ToString())%>'>
                                    <h2 class="product-title">
                                        <%#Eval("TenSanPham")%></h2>
                                </a></li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>
            <asp:Label runat="server" Text="" ID="lbThongbao"></asp:Label>
            <div style="width: 100%; float: left; margin-top: 10px;">
                <div style="float: left;">
                    <asp:ImageButton ID="cmdPrev" Visible="false" OnClick="cmdPrev_Click" runat="server"
                        ImageUrl="~/images/prevpage.png" /></div>
                <div style="float: right;">
                    <asp:ImageButton ID="cmdNext" Visible="false" OnClick="cmdNext_Click" runat="server"
                        ImageUrl="~/images/nextpage.png" /></div>
            </div>
        </div>
   
</asp:Content>
